<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="10">
<title>ANT_LOG</title>
<LINK href="/monitor/css/basic.css" rel="stylesheet" type="text/css">
<script src="/monitor/jquery-ui-1.10.1.custom/js/jquery-1.9.1.js" type="text/javascript" ></script>
<script src="/monitor/js/basic.js" type="text/javascript" ></script>
</head>
<body>
<c:if test="${!empty param.PARAM_JOB_ID}">
   <c:set var="where1" value="AND JOB_ID = '${param.PARAM_JOB_ID}'" />			
</c:if>
<sql:query var='test' dataSource="antDataSource">
SELECT JOB_ID, JOB_NAME, TO_CHAR(START_DATE,'YYYY/MM/DD HH24:MI:SS') START_DATE, TO_CHAR(END_DATE,'YYYY/MM/DD HH24:MI:SS') END_DATE, 
       
       CASE WHEN END_DATE IS NOT NULL THEN
       	trunc(mod((END_DATE-START_DATE)*24,1)*60) || ' min ' || trunc(round(mod((END_DATE-START_DATE)*24*60,1)*60)) || ' sec ' 
       ELSE
       	trunc(mod((SYSDATE-START_DATE)*24,1)*60) || ' min ' || trunc(round(mod((SYSDATE-START_DATE)*24*60,1)*60)) || ' sec '
       END ELAPSED, 
       
       STATUS, TO_CHAR(LOG_DATE,'YYYY/MM/DD HH24:MI:SS') LOG_DATE 
       
  FROM MONUSER.ANT_LOG
	WHERE 1 = 1
	  AND ROWNUM < 100
	 ${where1}
 </sql:query>	
<h3>ANT_LOG</h3>
 <form method="post">
	<table>
		<tr>
			<td>JOB_ID</td>
			<td><input name="PARAM_JOB_ID" value="${param.PARAM_JOB_ID}"></td>
		</tr>
	</table>
	<input type="submit" />
</form>
<br/>
<table border="1">
	<tr>
			<td class="header">JOB_ID</td>
			<td class="header">JOB_NAME</td>
			<td class="header">START_DATE</td>
			<td class="header">END_DATE</td>
			<td class="header">ELAPSED_TIME</td>
			<td class="header">STATUS</td>
			<td class="header">LOG_DATE</td>
		</tr>
	<c:forEach var="row" items="${test.rows}">
	<tr onclick="setLineBGColor(this)">
			<td>${row.JOB_ID}</td>
			<td>${row.JOB_NAME}</td>
			<td>${row.START_DATE}</td>
			<td>${row.END_DATE}</td>
			<td style="text-align: right;">${row.ELAPSED}</td>
			<td>${row.STATUS}</td>
			<td>${row.LOG_DATE}</td>
		</tr>
	</c:forEach>
</table>
</body>
</html> 